package ruanjian.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import ruanjian.dao.CustomerDao;
import ruanjian.domain.Customer;
import ruanjian.service.CustomerService;

import java.util.List;

@Service("customerService")
public class CustomerServiceImpl implements CustomerService {
    // 声明DAO属性并注入
    @Autowired
    private CustomerDao customerDao;
    @Override
    public List<Customer> selectCustomerList() {
        List<Customer> customers =
                customerDao.selectCustomerList();
        return customers;
}

    @Override
    public int createCustomer(Customer customer) {
        return customerDao.createCustomer(customer);
    }
    /**
     * 通过id查询客户
     */
    @Override
    public Customer getCustomerById(Integer id) {
        Customer customer = customerDao.getCustomerById(id);
        return customer;
    }

    @Override
    public int updateCustomer(Customer customer) {
        return customerDao.updateCustomer(customer);
    }

    @Override
    public int deleteCustomer(Integer id) {
        return customerDao.deleteCustomer(id);
    }
}
